home *** CD-ROM | disk | FTP | other *** search
- /* Programmer's guide to GEM - 1986 - p.158 -listing 3.2 - CJPurcell Dec'86 */
- /* CTRLRC.C - MAIN DRIVER for draw_rc() examples using Mark Williams C */
- /* to be tested in NDC and/or RC mode with or without GDOS for implications */
- #include <portab.h> /* try <> and see ?? */
- #include <osbind.h> /* system constants */
- #include <gemdefs.h> /* GEM-definition */
- /* #include <obdefs.h> / * object definition*/
-
- WORD contrl[12], intin[128], ptsin[128], intout[128], ptsout[128];
-
- #define M_OFF 256
- #define RC_COORDS 2
- #define RIGHT_ALIGNED 2
- #define BOTTOM_ALIGNED 3
-
- VOID main() /* not GEMAIN as in ref. */
- {
- WORD handle, work_in[11], work_out[57], max_w, max_h;
- WORD ii;
-
- appl_init(); /* init AES for call */
- handle = graf_handle( &ii,&ii,&ii,&ii ); /* get screen handle */
- graf_mouse( M_OFF, NULL ); /* hide mouse */
- v_clrwk( handle ); /* clear workstation */
-
- for( ii=0; ii<11; ++ii ) work_in[ii]=1; /* init work_in array*/
- work_in[10] = RC_COORDS; /* using RC coordinates */
- v_opnvwk( work_in, &handle, work_out ); /* open the workstation */
-
- max_w = work_out[0]; max_h = work_out[1];
- draw_rc( handle,0,0,max_w,max_h ); /* do the examp.routine */
-
- vst_alignment( handle,RIGHT_ALIGNED,BOTTOM_ALIGNED,&ii,&ii );
- v_gtext( handle,max_w,max_h,"Press any Key to Continue" );
- evnt_keybd(); /* pause for viewing */
- v_clsvwk( handle ); /* close workstation */
- appl_exit(); /* tell AES finished */
- }
-
- /* Programmer's Guide to GEM - 1986 - p.199,Listing 3.13 - CJPurcell- Dec'86 */
- /* TEXTEFCT.C - ILLUSTRATE different Graphic Text Special Effects on GEM */
- /* #include <portab.h> */
- #define SYSTEM_FONT 1
- #define SWISS_FONT 2
- #define LEFT 0
- #define RIGHT 2
- #define BASELINE 0
-
- BYTE *labels[] = { "Normal", "Thickened", "Light", "Skewed", "Underlined",
- "Outlined", "Shadowed" };
-
- VOID draw_rc( handle, dx, dy, swidth, sheight )
- WORD handle, dx, dy, swidth, sheight;
- {
- WORD ii, cur_x, cur_y, incr_x, incr_y, junk, effect, resize;
-
- resize = 18 ; /* presume color system, but*/
- if ( 2 == Getrez() ) resize = 36 ; /* BIG_LETTERS */
-
-
- vst_load_fonts( handle, 0 ); /* load all available fonts */
- incr_x = swidth / 40 ;
- incr_y = sheight / 8 ;
- cur_x = dx + swidth / 4 ;
- cur_y = dy + incr_y ;
-
- for( ii = 0, effect = 1; ii < 7; ++ii, cur_y += incr_y){
- vst_font( handle, SWISS_FONT );
- vst_point( handle, resize, &junk, &junk, &junk, &junk );
- vst_alignment( handle, LEFT, BASELINE, &junk, &junk );
- if(ii>0) /* no call for normal effect */
- {
- junk = vst_effects( handle,effect );
- effect *= 2 ; /* shift left effects bit by 1 */
- if( effect != junk*2 )
- continue; /* don't print lines without effect*/
- }
- v_gtext( handle, cur_x+incr_x, cur_y, "String" );
- vst_font( handle, SYSTEM_FONT);
- vst_point( handle, 14, &junk, &junk, &junk, &junk );
- vst_alignment( handle, RIGHT, BASELINE, &junk, &junk );
- v_gtext( handle, cur_x, cur_y, labels[ii] );
- }
- vst_effects( handle, 0 ); /* turn off special effects */
- vst_unload_fonts( handle, 0 );
- } /* CJPurcell 08Dec'86 */
-